home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kresources / selectdialog.h < prev   
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.3 KB  |  88 lines

  1. /*
  2.     This file is part of libkresources.
  3.  
  4.     Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
  5.     Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
  6.     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
  7.  
  8.     This library is free software; you can redistribute it and/or
  9.     modify it under the terms of the GNU Library General Public
  10.     License as published by the Free Software Foundation; either
  11.     version 2 of the License, or (at your option) any later version.
  12.  
  13.     This library is distributed in the hope that it will be useful,
  14.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.     Library General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU Library General Public License
  19.     along with this library; see the file COPYING.LIB.  If not, write to
  20.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21.     Boston, MA 02110-1301, USA.
  22. */
  23.  
  24. #ifndef KRESOURCES_SELECTDIALOG_H
  25. #define KRESOURCES_SELECTDIALOG_H
  26.  
  27. #include <qobject.h>
  28. #include <qptrlist.h>
  29. #include <qmap.h>
  30.  
  31. #include <kdialog.h>
  32.  
  33. class KListBox;
  34.  
  35. namespace KRES {
  36.  
  37. class Resource;
  38.  
  39. /**
  40.  * Dialog for selecting a resource.
  41.  *
  42.  * Example:
  43.  *
  44.  * \code
  45.  *
  46.  * QPtrList<Resource> list = ... // can be retrived from KRES::Manager (e.g. KABC::AddressBook)
  47.  *
  48.  * KABC::Resource *res = KABC::SelectDialog::getResource( list, parentWdg );
  49.  * if ( !res ) {
  50.  *   // no resource selected
  51.  * } else {
  52.  *   // do something with resource
  53.  * }
  54.  * \endcode
  55.  */
  56. class KRESOURCES_EXPORT SelectDialog : KDialog
  57. {
  58.   public:
  59.     /**
  60.      * Constructor.
  61.      * @param list   The list of available resources
  62.      * @param parent The parent widget
  63.      * @param name   The name of the dialog
  64.      */
  65.     SelectDialog( QPtrList<Resource> list, QWidget *parent = 0,
  66.         const char *name = 0);
  67.  
  68.     /**
  69.      * Returns selected resource.
  70.      */
  71.     Resource *resource();
  72.  
  73.     /**
  74.      * Opens a dialog showing the available resources and returns the resource the
  75.      * user has selected. Returns 0, if the dialog was canceled.
  76.      */
  77.     static Resource *getResource( QPtrList<Resource> list, QWidget *parent = 0 );
  78.  
  79.   private:
  80.     KListBox *mResourceId;
  81.  
  82.     QMap<int, Resource*> mResourceMap;
  83. };
  84.  
  85. }
  86.  
  87. #endif
  88.